
#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include "Length.h"
#include "Volume.h"
#include "UnitFactory.h"

USING_MOCKCPP_NS
USING_TESTNGPP_NS

UnitFactory *pUnitFactory = UnitFactory::getInstance();
Unit* Mile = pUnitFactory->getUnit("MILE");
Unit* Yard = pUnitFactory->getUnit("YARD");
Unit* Feet = pUnitFactory->getUnit("FEET");

Unit* Oz = pUnitFactory->getUnit("OZ");
Unit* Tsp = pUnitFactory->getUnit("TSP");
Unit* Tbsp = pUnitFactory->getUnit("TBSP");

FIXTURE(Length,"Test Length")
{
	TEST("1 mile = 1760 Yard")
	{
		ASSERT_EQ(Length(1,Mile), Length(1760,Yard));
	}

	TEST("1 yard = 3 feet")
	{
		ASSERT_EQ(Length(1,Yard), Length(3,Feet));
	}
};


FIXTURE(Volume,"Test Volume")
{
	TEST("1 OZ == 3 TSP")
	{
		ASSERT_EQ(Volume(1,Oz), Volume(3,Tsp));

	}

	TEST("1 OZ != 5 TSP")
	{
		ASSERT_FALSE(Volume(1,Oz) == Volume(5,Tsp));
	}

	TEST("1 TSP == 4 TBSP")
	{
		ASSERT_EQ(Volume(1,Tsp), Volume(4,Tbsp));
	}

	TEST("1 TSP != 7 TBSP")
	{

		ASSERT_FALSE(Volume(1,Tsp) == Volume(7,Tbsp));
	}

	TEST("1 OZ == 3*4 TBSP")
	{
		ASSERT_EQ(Volume(1, Oz), Volume(3*4, Tbsp));
	}

	TEST("1 OZ != 10 TBSP")
	{
		ASSERT_FALSE(Volume(1, Oz) == Volume(10, Tbsp));
	}

};


FIXTURE(Add,"Test add")
{
	TEST("2 MILE = 1 MILE + 1 MILE")
	{
		ASSERT_EQ(Length(2,Mile),Length(1,Mile)+Length(1,Mile));
	}


	TEST("2 MILE = 1760 yard + 1760 yard")
	{
		ASSERT_EQ(Length(2,Mile),Length(1760,Yard)+Length(1760,Yard));
	}

	TEST("2 MILE = 1760 yard + 1760*3 feet")
	{
		ASSERT_EQ(Length(2,Mile),Length(1760,Yard)+Length(1760*3,Feet));
	}

	TEST("2 YARD = 1 YARD + 1 YARD")
	{
		ASSERT_EQ(Length(2,Yard),Length(1,Yard)+Length(1,Yard));
	}

	TEST("2 YARD = 1 YARD + 3 feet")
	{
		ASSERT_EQ(Length(2,Yard),Length(1,Yard)+Length(3,Feet));
	}

	TEST("2 FEET = 1 FEET + 1 FEET")
	{
		ASSERT_EQ(Length(2,Feet),Length(1,Feet)+Length(1,Feet));
	}

	TEST("2 OZ = 1 OZ + 1 OZ")
	{
		ASSERT_EQ(Volume(2,Oz),Volume(1,Oz)+Volume(1,Oz));
	}

	TEST("2 OZ = 1 OZ + 4 tsp")
	{
		ASSERT_EQ(Volume(2,Oz),Volume(1,Oz)+Volume(4,Tsp));
	}

	TEST("2 OZ = 1 OZ + 12 tbsp")
	{
		ASSERT_EQ(Volume(2,Oz),Volume(1,Oz)+Volume(12,Tbsp));
	}

	TEST("2 OZ = 3 tsp + 12 tbsp")
	{
		ASSERT_EQ(Volume(2,Oz),Volume(3,Tsp)+Volume(12,Tbsp));
	}

	TEST("2 TSP = 1 TSP + 1 TSP")
	{
		ASSERT_EQ(Volume(2,Tsp),Volume(1,Tsp)+Volume(1,Tsp));
	}

	TEST("2 TSP = 1 TSP + 4 tbsp")
	{
		ASSERT_EQ(Volume(2,Tsp),Volume(1,Tsp)+Volume(4,Tbsp));
	}

	TEST("4 TBSP = 1 TBSP + 3 TBSP")
	{
		ASSERT_EQ(Volume(4,Tbsp),Volume(1,Tbsp)+Volume(3,Tbsp));
	}
};

